﻿using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.JDPostBoard.Entity
{
    [Table("MeetingAttachment", "", "JDPB.ConnectionString")]
    public class MeetingAttachment : Info
    {
        #region SQL column name consts
        public const string SQLCOL_ATTACHMENTID = "AttachmentID";
        public const string SQLCOL_APPLYID = "ApplyID";
        public const string SQLCOL_ATTACHMENTREALNAME = "AttachmentRealName";
        public const string SQLCOL_UPLOADTIME = "UploadTime";
        public const string SQLCOL_ATTACHMENTNAME = "AttachmentName";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public MeetingAttachment() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public MeetingAttachment(Guid AttachmentID)
        {
            this.AttachmentID = AttachmentID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            AttachmentID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_ATTACHMENTID]);
            ApplyID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_APPLYID]);
            AttachmentRealName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ATTACHMENTREALNAME]);
            UploadTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_UPLOADTIME]);
            AttachmentName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ATTACHMENTNAME]);
        }

        #region Properties
        #region Property <Guid> AttachmentID
        [Property("AttachmentID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid AttachmentID
        {
            get { return _AttachmentID; }
            set { _AttachmentID = value; }
        }
        private Guid _AttachmentID = Guid.Empty;
        #endregion

        #region Property <int> ApplyID
        [Property("ApplyID", 4, SqlDbType.Int, false, false)]
        public int ApplyID
        {
            get { return _ApplyID; }
            set { _ApplyID = value; }
        }
        private int _ApplyID = int.MinValue;
        #endregion

        #region Property <string> AttachmentRealName
        [Property("AttachmentRealName", 200, SqlDbType.VarChar, false, false)]
        public string AttachmentRealName
        {
            get { return _AttachmentRealName; }
            set { _AttachmentRealName = value; }
        }
        private string _AttachmentRealName = null;
        #endregion

        #region Property <DateTime> UploadTime
        [Property("UploadTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime UploadTime
        {
            get { return _UploadTime; }
            set { _UploadTime = value; }
        }
        private DateTime _UploadTime = DateTime.MinValue;
        #endregion

        #region Property <string> AttachmentName
        [Property("AttachmentName", 200, SqlDbType.VarChar, false, false)]
        public string AttachmentName
        {
            get { return _AttachmentName; }
            set { _AttachmentName = value; }
        }
        private string _AttachmentName = null;
        #endregion
        #endregion




    }
}
